package juc.juccore.threadlocal;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 将线程不安全的threadlocal类转换为线程安全的工具类
 */
public class ThreadLocalNormalUsage00 {
    public static void main(String[] args) {
        new Thread(() -> {
            String data = new ThreadLocalNormalUsage01().data(10);
            System.out.println(data);
        }).start();
        new Thread(() -> {
            String data = new ThreadLocalNormalUsage01().data(1007);
            System.out.println(data);
        }).start();

    }

    public String data(int seconds) {
        Date date = new Date(1000 * seconds);
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return format.format(date);
    }

}
